#pragma once
#include "BaseInc.h"
#include "Texture.h"
class TextureManager
{
    bool bLoad{ false };
public:
    static TextureManager& GetInst()
    {
        static TextureManager inst;
        return inst;
    }
    TextureManager()
    {
        RegisterTexture();
    }
    void RegisterTexture() {
        if (!bLoad)
        {
            bLoad = true;
            Texture* tex = new Texture();
            tex->LoadFromFile("tex.jpeg");
            texs.push_back(tex);
            tex = new Texture();
            tex->LoadFromFile("cube.jpeg");
            texs.push_back(tex);
        }
    }
    ~TextureManager()
    {
        for (int i = 0; i < texs.size(); i++)
        {
            delete texs[i];
        }
    }
    Texture* GetTexture(int texId)
    {
        return texs[texId];
    }
    vec3 GetColor(int texId, int s, int t)
    {
        return texs[texId]->GetColor(vec2(s, t));
    }
    vec3 GetColorXY(int texId, int s, int t)
    {
        Texture* tex = texs[texId];
        return tex->GetTextureColor(s, t);
    }
private:
    std::vector<Texture*> texs;
};